/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package me.panpf.sketch;

import ohos.hiviewdfx.HiLogLabel;

/**
 * @Description: java类作用描述
 * @CreateDate: 2021/6/3 10:19
 */
public class HiLog {
    private static final String TAG = "sketch";
    private static HiLogLabel sLogLabel;
    private static final int DOMAIN = 0x001;

    private static HiLogLabel createLogLabel() {
        if (sLogLabel == null) {
            sLogLabel = new HiLogLabel(ohos.hiviewdfx.HiLog.LOG_APP, DOMAIN, TAG);
        }
        return sLogLabel;
    }

    /**
     * info
     *
     * @param format
     * @param objects
     */
    public static void info(String format, Object... objects) {
        ohos.hiviewdfx.HiLog.info(createLogLabel(), format, objects);
    }

    /**
     * debug
     *
     * @param format
     * @param objects
     */
    public static void debug(String format, Object... objects) {
        ohos.hiviewdfx.HiLog.debug(createLogLabel(), format, objects);
    }

    /**
     * error
     *
     * @param format
     * @param objects
     */
    public static void error(String format, Object... objects) {
        ohos.hiviewdfx.HiLog.error(createLogLabel(), format, objects);
    }

    /**
     * warn
     *
     * @param format
     * @param objects
     */
    public static void warn(String format, Object... objects) {
        ohos.hiviewdfx.HiLog.warn(createLogLabel(), format, objects);
    }

    /**
     * fatal
     *
     * @param format
     * @param objects
     */
    public static void fatal(String format, Object... objects) {
        ohos.hiviewdfx.HiLog.fatal(createLogLabel(), format, objects);
    }

}
